<!DOCTYPE html>
<html ng-app="testApp">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="height=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <title>Angular JavaScript Demo</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="js/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="js/bootstrap.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-controller="formController">
    <input type="text" ng-model="name">{{name}}
</div>
<script type="text/javascript">
    var app = angular.module('testApp',[]);
    //解析表达式
    app.controller('formController',function($scope,$parse){
      //监控并解析表达式
      $scope.$watch("name",function(newVal,oldVal,scope){
        //debugger
        if(newVal!=oldVal){
            var parseFun = $parse(newVal);
            $scope.parsedValue = parseFun(scope);
        }
      });

    });
</script>
</body>
</html>